package com.graduation.rescuematerial.controller;


import com.graduation.rescuematerial.service.IHelpNewsService;
import com.graduation.rescuematerial.vo.RespBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author CaiShuangLian
 * @since 2022-04-24
 */
@Controller
@RequestMapping("/help/news")
@Api(tags = "新闻模块")
public class HelpNewsController {

    @Autowired
    private IHelpNewsService helpNewsService;

    @ApiOperation("获取新闻列表(不需要权限调用的接口)")
    @ResponseBody
    @GetMapping("/all")
    public RespBean getAll(){
        return helpNewsService.getAll("all");
    }

    @ApiOperation("获取未解决状态的求助信息")
    @GetMapping("/get/unsolve")
    @ResponseBody
    public RespBean getUnsolveInfo(){
        return helpNewsService.getAll("unsolve");
    }

    @ApiOperation("模糊查询")
    @PostMapping("/fuzzy/query")
    @ResponseBody
    public RespBean fuzzyQuery(@RequestParam("key") String key){
        return helpNewsService.fuzzyQuery(key);
    }

}
